/**
 * Copyright (c) 2009 blurredVision
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 * associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or 
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 
 * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#ifndef __IFONT_H__
#define __IFONT_H__

#pragma once
#include "ITexture.h"
#include "IResource.h"
#include <vector>
#include "geom/Vector.h"

enum eAlign {
	FONT_LEFT = 1,
	FONT_CENTER = 2,
	FONT_RIGHT = 4,
	FONT_CONDENSED = 8
};

enum eStyle {
	FONT_NORMAL = 0,
	FONT_BOLD = 1,
	FONT_ITALIC = 2,
};

/**
 * \ingroup CoreEngine
 * 
 * The IFont interface.<br>
 * A font can be used to display some text on the screen.<br>
 * A specific IFont instance can be created using ResourceFactory::loadBitmapFont() or ResourceFactory::loadTrueTypeFont()
 *
 * \date 03-28-2007
 *
 * \author juckel
 *
 */
class DLL_EXPORT IFont
	: public IResource
{
public:
	/// Loads a bitmap or truetype font
	virtual bool load(const std::string &image, int size, int style = FONT_NORMAL) = 0;

	/// Print a text at the specified position
	virtual void print(const std::string &str, int x, int y, int z=0, int align = FONT_LEFT, int width = 0, int heigth = 0, const math::Vector4 &color = math::Vector4(1,1,1,1)) = 0;

	/// Returns the size of the font
	int getSize() const;

	/// Returns <code>true</code> if the font is loaded, <code>false</code> otherwise
	bool isLoaded() const;

	/// Sets the color of the font as a 4D vector object. x,y,z,w represent r,g,b,a.
	//virtual void setColor(const math::Vector4 &_vCol);

	/// Sets the color of the font as float values
	//virtual void setColor(float r, float g, float b, float a);

	virtual unsigned int getType() { return RESTYPE_FONT; };

	/// Return the length of a given string
	virtual int getLength(const std::string &str) = 0;

protected:
	IFont(void);
	virtual ~IFont(void);

	void strsplit(const std::string& str, const std::string& delim, std::vector<std::string>& output);
	int iSize;
	bool bLoaded;
	math::Vector4 vColor;
};

#endif
